<template>
	<view class="classLayout pageBg">
		<custom-nav-bar title="分类"></custom-nav-bar>
		<view class="classify">
			<theme-item v-for="item in classfies" :key="item._id" :item="item"></theme-item>
		</view>
	</view>
</template>

<script setup>
	import {
		getClassfyAPI
	} from '@/apis/index.js'
	import {
		ref,
		onMounted
	} from 'vue'
	import {onShareAppMessage, onShareTimeline} from '@dcloudio/uni-app'
	const classfies = ref([])
	const getClassfy = async () => {
		const {
			data
		} = await getClassfyAPI({pageSize: 15})
		classfies.value = data.data
		// console.log(data.data)
	}
	onMounted(() => {
		getClassfy()
	})
	// 分享微信好友
	onShareAppMessage((e) =>{
		return {
			title: 'uni壁纸项目',
			path: '/pages/classfy/classfy'
		}
	})
	// 分享朋友圈
	onShareTimeline(() => {
		return {
			title:'uni壁纸项目'
		}
	})
</script>

<style lang="scss" scoped>
	.classify {
		padding: 30rpx;
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 15rpx;
	}
</style>